package com.hl233.framework.thread;

/**
 * @author 张振强15065206763
 * @create 2024-09-06
 */
public class MainProcess {

    public static void main(String[] args) {
        //三个人一起开始生产面包
        Thread breadProducerZhangsan = new Thread(new BreadProducer("张三"));
        Thread breadProducerLisi = new Thread(new BreadProducer("李四"));
        Thread breadProducerWangwu = new Thread(new BreadProducer("王五"));
        Thread breadProducerqisi = new Thread(new BreadProducer("七四"));
        breadProducerZhangsan.setName("breadProducerZhangsan");
        breadProducerLisi.setName("breadProducerLisi");
        breadProducerWangwu.setName("breadProducerWangwu");
        breadProducerqisi.setName("breadProducerqisi");
        breadProducerZhangsan.start();
        breadProducerLisi.start();
        breadProducerWangwu.start();
        breadProducerqisi.start();

        //三个个消费者去商店购买面包
        Thread breadConsumer1 = new Thread(new BreadConsumer("消费者1"));
        breadConsumer1.setName("breadConsumer1");
        breadConsumer1.start();
        Thread breadConsumer2 = new Thread(new BreadConsumer("消费者2"));
        breadConsumer2.setName("breadConsumer2");
        breadConsumer2.start();
        Thread breadConsumer3 = new Thread(new BreadConsumer("消费者3"));
        breadConsumer3.setName("breadConsumer3");
        breadConsumer3.start();
    }
}
